var gulp = require('gulp');
var ngAnnotate = require('gulp-ng-annotate');
var gutil = require('gulp-util');
var bower = require('bower');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var sh = require('shelljs');
var ngmin = require('gulp-ngmin');
var stripDebug = require('gulp-strip-debug');

gulp.task('minify', function() {
   return gulp.src(['app/app.js',
       //'app/components/snap/js/classie.js',
       //'app/components/snap/js/main4.js',
       //'app/js/*.js',
       'app/js/communal.js',
       'app/js/loginApp.js',
       'app/js/borrow.js',
       'app/js/boundPhone.js',
       'app/js/pickUp.js',
       'app/js/charge.js',
       'app/js/cdbRecord.js',
       'app/nearLaidian/nearLaidianView.js',
       'app/*/*Route.js',



       '!app/js/jquery.min.js',
       '!app/*/*_test.js',
        ]) //注意，此处特意如此，避免顺序导致的问题
       .pipe(ngAnnotate())
       .pipe(ngmin({dynamic: false}))
       .pipe(stripDebug())
       .pipe(uglify({outSourceMap: false}))
       .pipe(concat('all.min.js'))
       .pipe(gulp.dest('app/js/'))
});



gulp.task('css', function() {
    return gulp.src([

        'app/components/snap/css/menu_bubble.css',
        'app/css/*.css',
        'app/bower_components/html5-boilerplate/dist/css/normalize.css',
        'app/bower_components/html5-boilerplate/dist/css/main.css',
        'app/app.css',
    ]) //注意，此处特意如此，避免顺序导致的问题
        .pipe(minifyCss())   //执行压缩
        .pipe(concat('all.min.css'))
        .pipe(gulp.dest('app/css/'))
});